package org.qpcr.community.project.web;

import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hswebframework.web.authorization.annotation.Authorize;
import org.hswebframework.web.authorization.annotation.QueryAction;
import org.hswebframework.web.authorization.annotation.Resource;
import org.hswebframework.web.crud.web.reactive.ReactiveServiceCrudController;
import org.qpcr.community.project.model.entity.DataAnalysisInterpretationConditionEntity;
import org.qpcr.community.project.service.DataAnalysisInterpretationConditionService;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

import java.util.Collection;
import java.util.List;

@RestController
@RequestMapping({"/project/data-analysis-interpretation-condition", "/project/data-analysis/interpretation-condition"})
@Authorize(ignore = true)
@Resource(id = "data-analysis-interpretation-condition", name = "阴阳判断条件")
@Slf4j
@Tag(name = "阴阳判读条件接口")
@RequiredArgsConstructor
public class DataAnalysisInterpretationConditionController    implements
    ReactiveServiceCrudController<DataAnalysisInterpretationConditionEntity, String> {
    @Getter
    private final DataAnalysisInterpretationConditionService service;

    @GetMapping("list/{groupId}")
    @Authorize(ignore = true)
    public Mono<List<DataAnalysisInterpretationConditionEntity>> listByGroupId(@PathVariable String groupId) {
        return service.listByGroupId(groupId);
    }

    @PostMapping("batch")
    @QueryAction
    @Authorize(ignore = true)
    public Mono<Integer> saveBatch(@RequestBody Collection<DataAnalysisInterpretationConditionEntity> entities) {
        return service.saveBatch(entities);
    }
}
